import request from '@/utils/request'
import { Params, InsertPerson, PersonDetail, ReceivePerson, RejectPerson, ExtendPerson, IsolatePerson, BatchInsertPerson } from '@/types/person'

export function getPersonList(params: Params) {
  return request({
    url: '/individual/risk_personnel_list',
    method: 'get',
    params
  })
}

export function insertPerson(data: InsertPerson) {
  return request({
    url: '/individual/add_risk_personnel',
    method: 'post',
    data
  })
}

export function batchInsertPerson(data: BatchInsertPerson) {
  return request({
    url: '/individual/batch_add_risk_personnel',
    method: 'post',
    data
  })
}

export function getPersonInfo(id: string) {
  return request({
    url: `/individual/risk_personnel_info/${id}`,
    method: 'get',
  })
}

export function updatePerson(data: PersonDetail, id:string) {
  return request({
    url: `/individual/update_risk_personnel/${id}`,
    method: 'post',
    data
  })
}

export function receivePerson(data: ReceivePerson, id:string) {
  return request({
    url: `/individual/receive/${id}`,
    method: 'post',
    data
  })
}

export function rejectPerson(data: RejectPerson, id:string) {
  return request({
    url: `/individual/reject/${id}`,
    method: 'post',
    data
  })
}

export function extendPerson(data: ExtendPerson, id:string) {
  return request({
    url: `/individual/extend/${id}`,
    method: 'post',
    data
  })
}

export function relievePerson(id:string) {
  return request({
    url: `/individual/relieve/${id}`,
    method: 'post'
  })
}

export function isolatePerson(data: IsolatePerson,id:string) {
  return request({
    url: `/individual/isolate/${id}`,
    method: 'post',
    data
  })
}
